package com.liuyang.second.concurrency.chapter6;

public class ReaderWorker extends Thread {
    private final SharedData data;

    public ReaderWorker(SharedData data) {
        this.data = data;
    }

    @Override
    public void run() {
        try {
            while (true){
                char[] readBuffer = data.read();
                System.out.println(Thread.currentThread().getName()+" read "+ String.valueOf(readBuffer));
            }
        }catch (Exception e){
            e.printStackTrace();
        }

    }


}
